﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core
{
    public static partial class msg
    {
        public static dynamic inquiryNewMsg(string username)
        {
            var sql = new Sql.SqlDataContext();
            var ms = from m in sql.Message
                     where !m.read && m.to == username
                     orderby m.mid descending
                     select m.mid;
            return new
            {
                success = true,
                count = ms.Count(),
                mid = ms.FirstOrDefault()
            };
        }
    }
}